<?php
/**
 * 返回新闻幻灯片xml文档
 * 以json方式返回
 * solosky <solosky772@qq.com>
 */

include_once("common.php");

$cate = parseCategory(getVar($_GET, "category"));
$pre  = $config["DB_PREX"]; 
$limit = getVar($_GET,"limit",10,"int");
$sql  = "SELECT newshash,title FROM {$pre}news";
$db->query($sql);
$rows = $db->getRows();
$n = count($rows);
for($i=0; $i<$n; $i++){
	$news = $rows[$i];
	$sql2 = "SELECT mediahash FROM {$pre}media WHERE newshash=".$news["newshash"]." AND type='i'";
	$db->query($sql2);
	$thumbs = $db->getOneCol("mediahash");
	$sql3 = "UPDATE {$pre}news SET thumb='".implode("|",$thumbs)."',image=".count($thumbs)." WHERE newshash=".$news["newshash"];
	if($db->query($sql3))
		echo $news["title"]." - ".implode("|",$thumbs)."updated...<br />";
}
?>
        